package cn.janescott.inner.space.shiro.token;

import org.apache.shiro.authc.UsernamePasswordToken;

/**
 * 用户名 & 密码 & 验证码
 * @date 2018/7/26
 * @author scott
 */
public class UsernamePasswordCodeToken extends UsernamePasswordToken {

    private String code;

    public UsernamePasswordCodeToken() {
        super();
    }

    public UsernamePasswordCodeToken(String username, String password, boolean rememberMe, String host, String code) {
        super(username, password, rememberMe, host);
        this.code = code;
    }

    public UsernamePasswordCodeToken(String username, char[] password) {
        super(username, password);
    }

    public UsernamePasswordCodeToken(String username, char[] password, String code) {
        this(username, password);
        this.code = code;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

//  ----------------------------------------------------------------------
//  -----------------------fluent style-----------------------------------
//  ----------------------------------------------------------------------

    public static UsernamePasswordCodeToken build() {
        return new UsernamePasswordCodeToken();
    }

    public UsernamePasswordCodeToken code(String code) {
        this.setCode(code);
        return this;
    }

    public UsernamePasswordCodeToken username(String username) {
        super.setUsername(username);
        return this;
    }

    public UsernamePasswordCodeToken password(char[] password) {
        super.setPassword(password);
        return this;
    }

}
